<div class="flex-wrap">
  <%= render "menu" %>
  <div class="col-12 col-md-9">
    <%= form_for(Setting.new, url: admin_settings_path) do |f| %>
      <input type="hidden" name="_action" value="mailer" />

      <div class="sub-title"><%= t(".Mailer") %></div>

      <div class="form-group">
        <label class="control-label"><%= t(".Email sender") %></label>
        <%= f.email_field :mailer_from, value: Setting.mailer_from, class: "form-control", placeholder: "no-reply@bluedoc.io"  %>
        <div class="form-text">
          <%= t(".The Email sender of BlueDoc mails_html") %>
        </div>
      </div>

      <div class="form-group">
        <label class="control-label"><%= t(".SMTP options") %></label>
        <%= f.text_area :mailer_options, value: YAML.dump(Setting.mailer_options), class: "form-control", style: "height: 180px;"  %>
        <div class="form-text">
          <%= t(".Use YAML format to config the SMTP_html") %>
        </details>

        <div class="form-text">
          <p class="mt-2"><strong>For example:</strong></p>
          <pre style="padding: 20px; background: #f7f7f7;"><code>---
address: your-host.com
port: 25
domain: your-host.com
user_name: your-username
password: 123456
authentication: login
enable_starttls_auto: true</code></pre>
          <ul class="p-3">
            <li><strong>address</strong> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.</li>
            <li><strong>port</strong> - On the off chance that your mail server doesn't run on port 25, you can change it.</li>
            <li><strong>domain</strong> - If you need to specify a HELO domain, you can do it here.</li>
            <li><strong>user_name</strong> - If your mail server requires authentication, set the username in this setting.</li>
            <li><strong>password</strong> - If your mail server requires authentication, set the password in this setting.</li>
            <li><strong>authentication</strong> - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of "plain" (will send the password in the clear), "login" (will send password Base64 encoded) or "cram_md5" (combines a Challenge/Response mechanism to exchange information and a cryptographic Message Digest 5 algorithm to hash important information)</li>
            <li><strong>enable_starttls_auto</strong> - Detects if STARTTLS is enabled in your SMTP server and starts to use it (true / false). </li>
          </ul>
        </div>
      </div>

      <div class="form-group">
        <%= link_to t(".Send a test Email to me"), test_mail_admin_settings_path, class: "btn", data: { method: :post } %>
      </div>

      <div class="form-action">
        <%= f.submit t(".Save"), class: "btn btn-primary mr-1" %>
      </div>
    <% end %>
  </div>
</div>